package com.jeff.android.lab.android.lifecycle.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;

import com.jeff.android.lab.model.User;

import java.util.ArrayList;
import java.util.List;

public class UserListViewModel extends AbstractViewModel<User> {

    public UserListViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    public void loadData() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                List<User> data = new ArrayList<>();
                for (int i = 0; i < 10; i++) {
                    data.add(new User(i, "Jack" + i, 15 + i));
                }
                mLiveData.postValue(data);
            }
        }).start();
    }


}
